home *** CD-ROM | disk | FTP | other *** search
/ Hottest 6 / Hottest 6 (1996)(PDSoft)[!].iso / software / videoutils / a-g / ami2d / macros / hdeform.rexx < prev    next >
OS/2 REXX Batch file  |  1978-11-24  |  3KB  |  120 lines

  1. /* macro to plot deformed model to printer or postscript file */
  2. options results
  3. parse arg dev
  4.  
  5. address ami2d
  6.  
  7. scale = 1.0
  8. 'get scale'
  9. if result ~= 0.0 then scale = result
  10.  
  11. 'info(window)'
  12. parse var result xmin xmax ymin ymax
  13.  
  14. m = open('outfile','ram:plot.gnu','w')
  15.  
  16. select
  17.     when dev='dj' then do
  18.         m = writeln('outfile','set size 1,.83')
  19.         m = writeln('outfile','set term hpdj 300')
  20.         m = writeln('outfile','set output "par:"')
  21.     end
  22.     when dev='ps' then do
  23.         m = writeln('outfile','set size 1.2,1.2')
  24.         m = writeln('outfile','set term postscript portrait color "Bodoni-Normal" 14')
  25.         m = writeln('outfile','set output "ram:deform.ps"')
  26.     end
  27.     otherwise nop
  28. end
  29.  
  30. m = writeln('outfile','set xlabel')
  31. m = writeln('outfile','set ylabel')
  32. m = writeln('outfile','set key')
  33. m = writeln('outfile','set noxtics')
  34. m = writeln('outfile','set noytics')
  35. m = writeln('outfile','set noxzeroaxis')
  36. m = writeln('outfile','set noyzeroaxis')
  37. m = writeln('outfile','plot ['xmin':'xmax'] ['ymin':'ymax'] ''pipe:deform'' title "deformed" with lines 3,\')
  38. m = writeln('outfile','''pipe:elems'' title "undeformed" with lines 7')
  39. m = close('outfile')
  40.  
  41. address command 'run gnuplot ram:plot.gnu'
  42.  
  43. 'info'
  44. parse var result nnodes nelems nsolns
  45.  
  46. m = open('outfile','pipe:deform','w')
  47. m = writeln('outfile','# model - 'modelfile' nelems = 'nelems)
  48.  
  49. do i=0 to nelems-1
  50.     'info(elem,'i')'
  51.     parse var result nd id mid nn ni n.1 n.2 n.3 n.4 n.5 n.6 n.7 n.8 n.9
  52.     m = writeln('outfile','# element 'id)
  53.     if nn > 4 then do
  54.         nc = nn % 2
  55.         nm = 2
  56.     end
  57.     else do
  58.         nc = nn
  59.         nm = 1
  60.     end
  61.     do j=1 to nc
  62.         do k=1 to nm
  63.             l = j + nc*(k - 1)
  64.             'info(node,'n.l')'
  65.             parse var result nd id x1 y1
  66.             'info(soln,1,'n.l')'
  67.             parse var result nd id dx
  68.             'info(soln,2,'n.l')'
  69.             parse var result nd id dy
  70.             xx = x1 + scale*dx
  71.             yy = y1 + scale*dy
  72.             m = writech('outfile',left(xx,18))
  73.             m = writeln('outfile',left(yy,18))
  74.         end
  75.     end
  76.     'info(node,'n.1')'
  77.     parse var result nd id x1 y1
  78.     'info(soln,1,'n.1')'
  79.     parse var result nd id dx
  80.     'info(soln,2,'n.1')'
  81.     parse var result nd id dy
  82.     m = writech('outfile',left(x1 + scale*dx,18))
  83.     m = writeln('outfile',left(y1 + scale*dy,18))
  84.     m = writeln('outfile','')
  85. end
  86. m = close('outfile')
  87.  
  88. m = open('outfile','pipe:elems','w')
  89. m = writeln('outfile','# model - 'modelfile' nelems = 'nelems)
  90.  
  91. do i=0 to nelems-1
  92.     'info(elem,'i')'
  93.     parse var result nd id mid nn ni n.1 n.2 n.3 n.4 n.5 n.6 n.7 n.8 n.9
  94.     m = writeln('outfile','# element 'id)
  95.     if nn > 4 then do
  96.         nc = nn % 2
  97.         nm = 2
  98.     end
  99.     else do
  100.         nc = nn
  101.         nm = 1
  102.     end
  103.     do j=1 to nc
  104.         do k=1 to nm
  105.             l = j + nc*(k - 1)
  106.             'info(node,'n.l')'
  107.             parse var result nd id x1 y1
  108.             m = writech('outfile',left(x1,18))
  109.             m = writeln('outfile',left(y1,18))
  110.         end
  111.     end
  112.     'info(node,'n.1')'
  113.     parse var result nd id x1 y1
  114.     m = writech('outfile',left(x1,18))
  115.     m = writeln('outfile',left(y1,18))
  116.     m = writeln('outfile','')
  117. end
  118. m = close('outfile')
  119. exit
  120.